home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 5
/
Aminet 5 - March 1995.iso
/
Aminet
/
gfx
/
show
/
jpegAGAsrc21.lha
/
jpegAGAsrc
/
jpegAGA
/
pattern.c
< prev
next >
Wrap
C/C++ Source or Header
|
1995-01-14
|
1KB
|
64 lines
/* Fill the buffer with file names */
#include <dos/dosasl.h>
#ifndef __GNUC__
#include <pragmas/dos_pragmas.h>
#include <clib/dos_protos.h>
#else
#include <inline/dos.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#define MAXFILES 500
extern char *PicArray[];
extern int NumPictures;
void FillNameBuffer(char *pattern)
{
int i;
LONG error;
struct AnchorPath *MyAnchorPath;
MyAnchorPath = calloc(sizeof(struct AnchorPath)+256, 1);
if(MyAnchorPath == NULL)
{
printf("Out of memory!\n");
exit(10);
}
MyAnchorPath->ap_Strlen = 254;
error = MatchFirst(pattern, MyAnchorPath);
if(error) return;
while(!error)
{
PicArray[NumPictures] = malloc(strlen((char *)&MyAnchorPath->ap_Buf)+1);
if(!PicArray[NumPictures])
{
printf("Out of memory!\n");
MatchEnd(MyAnchorPath);
exit(10);
}
strcpy(PicArray[NumPictures], MyAnchorPath->ap_Buf);
/* puts(PicArray[NumPictures]); */
NumPictures++;
if(NumPictures == MAXFILES)
{
printf("Too many files!\n");
MatchEnd(MyAnchorPath);
return;
}
error = MatchNext(MyAnchorPath);
}
MatchEnd(MyAnchorPath);
if(MyAnchorPath) free(MyAnchorPath);
}